^ What's the point?
^ Note on 'Item' in the 'OnItemCallback' for TFilesProcessShell
^ Note on 'Handle' property for TFilesProcessShell
^ Receiving items sorted with TFilesProcessShell
^ Properties
^ Methods
^ Events

Download :: Top
TFilesProcess & TFilesProcessShell

Non-visual, callback event based mass file enumerator components with recursion.
Specify the root folder, and a filter for file names, and you get back the file names in a callback.
The package consists of 2 components: a file name based class 'TFilesProcess' and a shell (PIDL) based class 'TFilesProcessShell'. 'TFilesProcessShell' can also be used to enumerate shell folders as well.

Features:

  • Specify a file extension list to only return specific file types
  • Recurse subfolders
  • Scan all drives
  • Optional progress reporting
  • Shell items enumeration
  • Receive shell items sorted

TFilesProcess & TFilesProcessShell in freeware, shareware and commercial software?

The components come with full source code and can be evaluated freely. If you like it and decide to use it in a freeware, shareware or commercial (or any other money making - advertising, in app. selling, etc.) product one of the licenses is needed.


Note on 'Item' in the 'OnItemCallback' for TFilesProcessShell

'Item' is freed when the event returns, if the PIDL is needed outside the callback clone it with 'MyItem := ILClone(Item)', to free the clone call 'CoTaskMemFree(MyItem)' (add 'ActiveX' to the uses list).



Note on 'Handle' property for TFilesProcessShell

By default 'Handle' is set to 0. Set it to your window's 'Handle' value if needed. From the MSDN docs:

Type: HWND

If user input is required to perform the enumeration, this window handle should be used by the enumeration object as the parent window to take user input. An example would be a dialog box to ask for a password or prompt the user to insert a CD or floppy disk. If hwndOwner is set to NULL, the enumerator should not post any messages, and if user input is required, it should silently fail.



Receiving items sorted with TFilesProcessShell

By default the items are sorted alphabetically by shell ('SortCriteria' = 'scName'). To custom sort the list set 'SortCriteria' = 'scCustom' and implement the 'OnItemCompare' event.
A little speed-up can be achieved without sorting if it's not needed: set 'SortCriteria' = 'scCustom' and do not assign the 'OnItemCompare' event.



TFilesProcess properties

  • Criteria: String: File name criteria that will be used with FindFirst(). For example: '*.txt'.

  • MediaTypes: TMediaTypes: When no Path is given the media types selected will be searched.
        mtDRIVE_REMOVABLE,  // The drive can be removed from the drive.
        mtDRIVE_FIXED,      // The disk cannot be removed from the drive.
        mtDRIVE_REMOTE,     // The drive is a remote (network) drive.
        mtDRIVE_CDROM,      // The drive is a CD-ROM drive.
        mtDRIVE_RAMDISK     // The drive is a RAM disk.
    
  • Path: String: Root folder to begin in which to begin searching for specified files. Set it to '' (none) to search the whole computer. See MediaTypes.

  • Recurse: Boolean: Go into subfolders or not.



    TFilesProcess methods

  • Execute: Boolean: Start the processing task. Matches will be given in the FileProcessCallback() event.

  • Count: Int64: Perform a count task. After a count, the Execute() will be much faster due to Windows file system caching.

  • CountFiles: Integer: (Used internally.) Count the files in the specified folder and it's subfolders.

  • RecurseProcess: Integer: (Used internally.) Start the search for the files in the specified folder and it's subfolders. Matches will be given in the FileProcessCallback() event.


    TFilesProcess events

  • FileCountProgressCallback: Reports matching files found. Call Application.ProcessMessages inside if you don't want to freeze your program. Set Abort to True to abort the whole mass file processing task.

  • FileProcessCallback: The essential event of TFilesProcess. When a file is found that matches the Criteria the event will be called. Do what you want with the files here. You should call Application.ProcessMessages inside if you don't want to freeze your program. Set Abort to True to abort the whole mass file processing task.


    See the class's popup auto-complete menu while designing for all of it's properties/methodes...


  • [Top]